<template>
  <div id="app">
    <v-head></v-head>
    <div class="container-fluid">
      <div class="row">
        <v-aside></v-aside>
        <router-view :students="students" :infos="infos" :studentHistorys="studentHistorys"></router-view>
        <h3></h3>
      </div>
    </div>
  </div>
</template>

<script>
import header from "./components/header/header";
import aside from "./components/header/aside";

export default {
  data() {
    return {
      students: {},
      infos: {},
      studentHistorys:{}
    };
  },
  components: {
    "v-head": header,
    "v-aside": aside
  },
  methods: {
    getStudents() {
      this.$http.get("/students").then(
        response => {
          this.students = response.body;
        },
        response => {}
      );
    },
    getStudentsHistory() {
      this.$http.get("/history").then(
        response => {
          this.studentHistorys = response.body;
        },
        response => {}
      );
    },
    getData() {
      this.getStudents();
      this.getStudentsHistory();
    }
  },
  created: function() {
    this.getData()
  },
  watch: {
    "$route": "getData"
  }
};
</script>


